package com.angel.service.ServiceImpl;

import com.angel.mapper.SysMenuDao;
import com.angel.bean.SysMenu;
import com.angel.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysMenuServiceImpl implements SysMenuService {
    @Autowired
    private SysMenuDao sysMenuMapper;

    @Override
    public List<SysMenu> findAll(SysMenu sysMenu) {
        return sysMenuMapper.findAll(sysMenu);
    }

    @Override
    public SysMenu findOne(SysMenu sysMenu) {
        List<SysMenu> sysMenuList = this.findAll(sysMenu);
        if (sysMenuList == null || sysMenuList.isEmpty()) {
            return null;
        }
        return sysMenuList.get(0);
    }

    @Override
    public List<SysMenu> findMenuByUid(Long uid) {
        return sysMenuMapper.findById(uid);
    }

    @Override
    public List<SysMenu> findMenuByEid(Integer eid) {
        return sysMenuMapper.findMenuByEid(eid);
    }

    @Override
    public List<SysMenu> findMenuByEtid(Integer etid) {
        return sysMenuMapper.findMenuByEtid(etid);
    }

    @Override
    public int update(SysMenu sysMenu) {
        return sysMenuMapper.update(sysMenu);
    }
}
